<%@page import="eu.telecom_bretagne.RECRUT.data.model.Archive"%>
<%@page import="java.util.List"%>
<%@page import="eu.telecom_bretagne.RECRUT.service.IServiceArchive"%>
<%@page import="eu.telecom_bretagne.RECRUT.data.model.Employe"%>
<%@page import="eu.telecom_bretagne.RECRUT.service.IServiceEmploye"%>
<%@page import="javax.naming.InitialContext"%>

<%
	InitialContext ctx = new InitialContext();
	IServiceArchive serviceArchive = (IServiceArchive) ctx
			.lookup(IServiceArchive.JNDI_NAME);
	IServiceEmploye serviceEmploye = (IServiceEmploye) ctx
			.lookup(IServiceEmploye.JNDI_NAME);

	List<Archive> archives = serviceArchive.listeArchives();

	int id = Integer.parseInt(request.getParameter("id"));
	Employe employe = serviceEmploye.lireEmploye(id);
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Liste des archives</title>
</head>
<body>
	<h1>Liste des archives:</h1>
	<form method="post" action="supprimer_archive">
		<table id="archives">
			<tr>
				<th>Identifiant</th>
				<th>Titre</th>
				<th>Description</th>
				<th></th>
			</tr>
			<%
				for (Archive archive : archives) {
			%>
			<tr>
				<td><input type="checkbox" name="liste_archive"
					value="<%=archive.getId()%>"> <%=archive.getId()%></td>
				<td><a href="infos_archive.jsp?id=<%=archive.getId()%>"><%=archive.getTitre()%></a>
				</td>
				<td><a href="modifier_archive_form.jsp?id=<%=archive.getId()%>">Modifier</a>
				</td>
			</tr>
			<%
				}
			%>
		</table>
		<input type="submit" value="Supprimer les archives selectionnees">
	</form>
	<a href="infos_employe.jsp?id=<%=employe.getId()%>">Retour</a>
	<a href="creer_archive_form.jsp">Creer un archive</a>
</body>
</body>
</html>